/*
 * @Author: wangqizhang
 * @Date: 2024-04-26 15:37:48
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-05-07 08:45:35
 * @FilePath: /suixinji-server/model/note.model.js
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
const { DataTypes } = require('sequelize');
const seq = require('../db/connect');
const noteParams = {
  note_title: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: '标题',
    required: true,
    // validate: {
    //   args: [5],
    //   msg: '用户名长度不能小于5位',
    // },
  },
  note_description: {
    type: DataTypes.TEXT,
    allowNull: false,
    unique: false,
    comment: '描述',
    required: true,
  },
  note_content: {
    type: DataTypes.TEXT,
    allowNull: true,
    unique: false,
    comment: '内容',
    required: false,
  },
  group_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    unique: false,
    comment: '分组id',
    required: false,
    // validate: {
    //   args: [10],
    //   msg: '用户id长度不能小于10位',
    // },
  },
  note_type: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: false,
    comment: '类型',
    required: false,
    // validate: {
    //   args: [10],
    //   msg: '用户id长度不能小于10位',
    // },
  },
  user_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    unique: false,
    comment: '用户id',
    required: false,
    // validate: {
    //   args: [10],
    //   msg: '用户id长度不能小于10位',
    // },
  },
};
const Note = seq.define('db_note', noteParams);
Note.sync({ force: false });
module.exports = { Note, noteParams };
